<include file="application/home/view/public/header.html"/>
	<!--左侧导航 end-->	
	<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">			
		<div class="row">
			<ol class="breadcrumb">
				<li class="active position_tit">市场信息<span style=" padding:0px 5px;">/</span>会员注册</li>
			</ol>
		</div><!--/.row-->
		
		<div class="row">
			<div class="col-lg-12">
				<div class="panel panel-default">
					<div class="panel-heading">会员注册</div>
					<div class="panel-body">
					<form action="{:U('User/vip_register_add')}" method="post">
						<table class="table2 table_infor">
						    <thead>
						      <tr>
						        <th colspan="3" style=" text-align:center; background-color:#f5f5f5;">*为必填项目</th>
						      </tr>
						    </thead>
                            <tbody>
                              <tr>
                                <td class="right1 td1_wid">服务中心编号：</td>
                                <td class="td2_wid"><input class="form-control" Placeholder="" name="b_center" id="b_center" value="{$user['b_center']}"></td>
                                <td class="td3_wid"><span>*</span><input class="yz_btn" type="button" value="验证" onclick="bcenter();"></td>
                              </tr>
                              <tr>
                                <td class="right1 td1_wid">推荐人编号：</td>
                                <td class="td2_wid"><input class="form-control" Placeholder="" id="tuijian_id" name="tuijian_id" value="{$user['username']}"></td>
                                <td class="td3_wid"><span>*</span><input class="yz_btn" type="button" value="验证" onclick="tuijian();"></td>
                              </tr>
                               <tr>
                                <td class="right1 td1_wid">接点人编号：</td>
                                <td class="td2_wid"><input class="form-control" Placeholder="" name="jiedian_id" id="jiedian_id"></td>
                                <td class="td3_wid"><span>*</span><input class="yz_btn" type="button" value="验证" onclick="jiedian()"></td>
                              </tr>
                              <tr>
                                <td class="right1 td1_wid">安置区域：</td>
                               <td class="td2_wid">
	                               <select name="quyu" style=" width:30%; border-radius:4px; border:1px solid #eee; padding:6px 8px;">
	                                    <option value="1" <if condition="$user['quyu'] eq 1" >selected</if>>A区</option>
	                                    <option value="2" <if condition="$user['quyu'] eq 2" >selected</if>>B区</option>
	                                </select> 
                                </td>
                              </tr>
                              <tr>
                                <td colspan="3" style=" background-color: rgb(245, 245, 245); font-weight:bold; text-align:center;">密码</td>
                              </tr>
                               <tr>
                                <td class="right1 td1_wid">一级密码：</td>
                                <td class="td2_wid"><input type="password" class="form-control" Placeholder="" id="repwdtrade_one" name="pwd_one" value="$user['pwd']"></td>
                              </tr>
                               <tr>
                                <td class="right1 td1_wid">确认一级密码：</td>
                                <td class="td2_wid"><input type="password" class="form-control" Placeholder="" id="repwdtrade_ones" name="pwd" value="$user['pwd']"></td>
                              </tr>
                              <tr>
                                <td class="right1 td1_wid">二级密码：</td>
                                <td class="td2_wid"><input type="password" class="form-control" Placeholder="" id="repwdtrade_two" name="pwdtrade_one" value="$user['pwdtrade']"></td>
                              </tr>
                               <tr>
                                <td class="right1 td1_wid">确认二级密码：</td>
                                <td class="td2_wid"><input type="password" class="form-control" Placeholder="" id="repwdtrade_twos" name="pwdtrade" value="$user['pwdtrade']"></td>
                              </tr>
                               <tr>
                                <td colspan="3" style=" background-color: rgb(245, 245, 245); font-weight:bold; text-align:center;">会员资料</td>
                              </tr>
                              <tr>
                                <td class="right1 td1_wid">会员编号：</td>
                                <td class="td2_wid"><input style="background-color:#F3F3F3" class="form-control" name="username" value="{$user['username']}" readonly></td>
                                <td class="td3_wid"><span></span><input class="yz_btn" type="button" value="验证"></td>
                              </tr>
                              <tr>
                                <td class="right1 td1_wid">会员姓名：</td>
                                <td class="td2_wid"><input class="form-control" Placeholder=""></td>
                              </tr>
                              <tr>
                                <td class="right1 td1_wid">性别：</td>
                                <td class="td2_wid">
								<input style=" margin:13px 0px;" type="radio" name="sex" value="1" <if condition="$user['sex'] eq 1">checked</if>><span style="float:left; padding:0px 5px;">男</span>
								
                                <input style=" margin:13px 0px;" type="radio" name="sex" value="2" <if condition="$user['sex'] eq 2">checked</if>><span style=" float:left; padding:0px 5px;">女</span>
									</td>
                              </tr>
                               <script type="text/javascript" src="__PUBLIC__/Admin/js/birthday.js"></script>
								<script>
										$(document).ready(function(){
											$(function() {
								            $.ms_DatePicker({
								                YearSelector: "#year",
								                MonthSelector: "#month",
								                DaySelector: "#day",
								                FirstValue:{$user['birthday']|date='d',###},
								            });
											$("#year").val({$user['birthday']|date='Y',###});
											$("#month").val({$user['birthday']|date='m',###});
											$("#day").val({$user['birthday']|date='d',###});
											 
								    	});
										}); 
								</script> 
                              <tr>
                                <td class="right1 td1_wid">出生日期：</td>
                                <td class="td2_wid">
                                <select style=" border-radius:4px; border:1px solid #eee; padding:6px 8px;" id="year" name="year">
                                    <option> {$user['birthday']|date='Y',###}</option>
                                  </select>
                                  年
                                  <select style=" border-radius:4px; border:1px solid #eee; padding:6px 8px;" id="month" name="month">
                                    <option>{$user['birthday']|date='m',###}</option>
                                  </select>
                                  月
                                   <select style=" border-radius:4px; border:1px solid #eee; padding:6px 8px;" id="day" name="day">
                                    <option>{$user['birthday']|date='d',###}</option>
                                  </select>
                                  日
                                </td>
                              </tr>
                              <tr>
                                <td class="right1 td1_wid">联系地址：</td>
                                <td class="td2_wid">
                                	<select  name="province" id="province">

	                                </select>
	                                <select name="district" id="district">

	                                </select>
	                                <select name="city" id="city">

	                                </select>
                                </td>
                              </tr>
                              <tr>
                                <td class="right1 td1_wid">加盟资格：</td>
                                <td class="td2_wid">
                                <select style=" border-radius:4px; border:1px solid #eee; padding:6px 8px;" name="qualification">
                                    <option value="1" <if condition="$user['qualification'] eq 1" >selected</if>>1000元</option>
                                    <option value="2" <if condition="$user['qualification'] eq 2" >selected</if>>3000元</option>
                                    <option value="3" <if condition="$user['qualification'] eq 3" >selected</if>>5000元</option>
                                    <option value="4" <if condition="$user['qualification'] eq 4" >selected</if>>10000元</option>
                                    <option value="5" <if condition="$user['qualification'] eq 5" >selected</if>>30000元</option>
                                    <option value="6" <if condition="$user['qualification'] eq 6" >selected</if>>50000元</option>
                                </select>
                                </td>
                              </tr>
                            </tbody>
						</table>
                        
					</div>
                    <div class="panel-footer">
						<div class="input-group article_btn">
							<span class="input-group-btn">
								<a href="#"><input type="submit" class="btn btn-success btn-md btn_art_return"></a>
							</span>
						</div>
                        
					</div>
				</form>	
				</div>
			</div>
		</div><!--/.row-->
        		
	</div>	<!--/.main-->	
<script>
var a;
//服务中心编号ajax
function bcenter(){
    var b_center=$('#b_center').val();
   	if(b_center==''){
		alert("请输入服务中心编号");
		return false;
	}
   	
    $.post("/Admin/Member/addMember_ajax_center",{'b_center':b_center},function(data){
    	
    	alert(data.info);
    });
}
//推荐人编号ajax
function tuijian(){
	var tuijian=$('#tuijian_id').val();
	if(tuijian==''){
		alert("请输入推荐人编号");
		return false;
	}
	
	$.post("/Admin/Member/addMember_ajax_tuijian",{'tuijian_id':tuijian},function(data){
		alert(data.info);
	})
}
//接点人编号ajax
function jiedian(){
	var jiedian=$('#jiedian_id').val();
	if(jiedian==''){
		alert("请输入接点人编号");
		return false;
	}

	$.post("/Admin/Member/addMember_ajax_jiedian",{'jiedian_id':jiedian},function(data){
		alert(data.info);
	})
}

//密码比较函数
function passcmp(passlevel) {
	var passid = passlevel==1? "one" : "two";//如果传入1表示passid=repwdtrade_one,否则表示passid=repwdtrade_two
	passid = "repwdtrade_"+passid;
	pass1 = $("#"+passid).val();
	pass2 = $("#"+passid+"s").val();
	if(pass1==pass2){
		return 0;
	}else{
		return 1;
	}
}
//一级密码验证和二级密码验证
$(document).ready(function(){
	
	$('#repwdtrade_ones').blur(function(){
		if(passcmp(1)){
			alert('一级密码不相同');
		}
	});
	$('#repwdtrade_twos').blur(function(){
		if(passcmp(2)){
			alert('二级密码不相同');
		}
	});

});



</script>
<!-- 城市联动 -->
 <script>
        var province_id = null;
        var district_id = null;
        var city_id = null;
        //初始化就开始填充城市联动的select
        //使用ajax获取城市数据
        function getlevel(area_id,area_type) {
            $.post("{:U('/admin/common/getpri')}",{area_id:area_id},function(data){
                //解码json
               
               var pri = $.parseJSON(data);
                //alert(pri[11]['area_id']);
                //将数据填充到省的位置
                //alert(data);
                if(area_type==1){
                    province_id= pri[0]['area_id'];
                    //清除下一层原来的数据
                    $("#district").html(" ");
                    for (x in pri)
                    {
                       $("#province").append("<option value="+pri[x]['area_id']+">"+pri[x]['area_name']+"");
                    }
                        getlevel(province_id,2);
                }
                if(area_type==2){
                    district_id= pri[0]['area_id'];
                    $("#district").html(" ");
                    for (x in pri)
                    {
                       $("#district").append("<option value="+pri[x]['area_id']+">"+pri[x]['area_name']+"");
                    }
                    getlevel(district_id,3);
                }
                if(area_type==3){
                    district_id= pri[0]['area_id'];
                    $("#city").html(" ");
                    for (x in pri)
                    {
                       $("#city").append("<option value="+pri[x]['area_id']+">"+pri[x]['area_name']+"");
                    }
                }


            });
        }

    $("#province").change(function(){
        var id = $("#province").val();
        getlevel(id,2);
    });
    $("#district").change(function(){
        var id = $("#district").val();
        getlevel(id,3);
    });
    getlevel(1,1);

</script>

</html>
